/*
 * PaymentBO.java
 *
 * Created on March 5, 2007, 8:07 PM
 *
 */

package edu.byu.isys413.group1E.data;

/** Contains the information regarding a payment made (the amount, change, and 
 * payment type.
 *
 * @author Travis Kulbeth
 */
public class PaymentBO {
    
    private String paymentID;
    private double pmtAmount;
    private double pmtChange;
    private String type;
    boolean alreadyInDB;
    boolean isDirty;

    /** Creates a new instance of PaymentBO */
    PaymentBO() {
    }
    
    /** Creates a new instance of TransactionBO with an ID
     *@param pmtID contains the ID for this payment (unique GUID)
     */
    PaymentBO(String pmtID) {
        setPaymentID(pmtID);
        setIsDirty(true);
    }
    
    /** Returns the paymentID
     *@return paymentID
     */
    public String getPaymentID() {
        return paymentID;
    }

    /** Sets the payment ID (originally generated by the GUID class)
     *@param paymentID contains the id for this payment
     */
    public void setPaymentID(String paymentID) {
        setIsDirty(true);
        this.paymentID = paymentID;
    }

    /** Returns the payment amount
     *@return pmtAmount
     */
    public double getPmtAmount() {
        return pmtAmount;
    }

    /** Sets the amount paid
     *@param pmtAmount contains the amount for this payment
     */
    public void setPmtAmount(double pmtAmount) {
        setIsDirty(true);
        this.pmtAmount = pmtAmount;
    }
    
    /** Returns the change necessary for the payment
     *@return pmtChange
     */
    public double getPmtChange() {
        return pmtChange;
    }

    /** Stores the amount of the payment
     *@param pmtChange contains the amount of change for this payment
     */
    public void setPmtChange(double pmtChange) {
        setIsDirty(true);
        this.pmtChange = pmtChange;
    }

    /** Returns the type of the payment (i.e., credit card, 
     * cash, or check)
     *@return type
     */
    public String getType() {
        return type;
    }

    /** Sets the type of payment (i.e., credit card,
     * cash, or check)
     *@param type of payment
     */
    public void setType(String type) {
        setIsDirty(true);
        this.type = type;
    }
    
    /** Sets the alreadyInDB variable to indicate that 
     * the information contained in this object has been stored in the database
     *@param is indicates if the Payment has been saved to the db already
     */
    public void setAlreadyInDB(boolean is){
        setIsDirty(true);
        this.alreadyInDB = is;
    }

    /** Returns if the information contained in this object has already been stored in the database
     *@return alreadyInDB
     */
    public boolean isAlreadyInDB() {
        return alreadyInDB;
    }

    /** Returns if information has been changed within this object
     *@return isDirty
     */
    public boolean isIsDirty() {
        return isDirty;
    }

    /** Sets the variable isDirty to indicate that some information has been modified or changed
     *in this object
     *@param isDirty indicates if data has changed
     */
    public void setIsDirty(boolean isDirty) {
        this.isDirty = isDirty;
    }    

}
